//
//  Rview.m
//  项目二
//
//  Created by rimi on 16/5/26.
//  Copyright © 2016年 objective. All rights reserved.
//

#import "Rview.h"
#import "HShowAlertUtils.h"
@implementation Rview

-(instancetype)initWithOriginPoint:(CGPoint)pOrigin{
    if (self = [super initWithFrame:CRM(pOrigin.x, pOrigin.y, 100, 100)]) {
        [self setBackgroundColor:[UIColor redColor]];
    }
    return self;
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [HShowAlertUtils showAlertWithMessage:@"RedViewAction" cancelAction:^{
        NSLog(@"1");
    } commitAction:^{
        NSLog(@"2");
    }];
}

-(UIViewController *)fetchViewControllerByView:(UIView *)aView{
    for (UIView *next = aView; next;next = next.superview) {
        UIResponder *responder = [next nextResponder];
        if ([responder isKindOfClass:[UIViewController class]]) {
            return  (UIViewController *)responder;
        }
    }
    return nil;
}
@end
